package com.example.chapter04;

import androidx.appcompat.app.AppCompatActivity;

import android.content.ComponentName;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;

public class ActStartActivity extends AppCompatActivity implements View.OnClickListener {
    final String TAG = "ActStartActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_act_start);
        Log.d("ActStartActivity", "onCreate");
        findViewById(R.id.btn_act_next).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        // 1. 在Intent构造中指定
        // Intent intent = new Intent(this, ActFinishActivity.class);

        // 2. 调用意图对象的setClass方法指定
        Intent intent = new Intent();
        // intent.setClass(this, ActFinishActivity.class);

        // 3. 调用意图对象的setComponent方法指定
        ComponentName component = new ComponentName(this, ActFinishActivity.class);
        intent.setComponent(component);
        startActivity(intent);


    }

    @Override
    protected void onStart() {
        super.onStart();
        Log.d("ActStartActivity", "onStart");
    }

    @Override
    protected void onResume() {
        super.onResume();
        Log.d("ActStartActivity", "onResume");
    }

    @Override
    protected void onPause() {
        super.onPause();
        Log.d("ActStartActivity", "onPause");
    }

    @Override
    protected void onStop() {
        super.onStop();
        Log.d("ActStartActivity", "onStop");
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        Log.d("ActStartActivity", "onDestroy");
    }

    @Override
    protected void onRestart() {
        super.onRestart();
        Log.d("ActStartActivity", "onRestart");
    }
}